<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'vehicle.label', default: 'Vehicle')}"/>
    <title>编辑配置</title>
</head>

<body>
<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>PLS CINDATA</li>
                    <li>
                        <g:link controller="profile" action="index">列表</g:link>
                    </li>
                    <li class="active">
                        <span>编辑配置</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light m-b-xs">
                编辑配置
            </h2>
        </div>
    </div>
</div>

<g:form resource="${this.profile}" method="PUT" class="editForm">
    <g:if test="${flash.message}">
        <div class="message alert alert-info" role="status">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${this.profile}">
        <ul class="errors" role="alert">
            <g:eachError bean="${this.profile}" var="error">
                <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message
                        error="${error}"/></li>
            </g:eachError>
        </ul>
    </g:hasErrors>

    <div class="content animate-panel">
        <div class="row">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    配置基本信息
                </div>

                <div class="panel-body form-horizontal">

                    <div class="form-group">
                        <label class="col-md-2 control-label ">名称</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="name" id="name" value="${profile?.name}"/>
                        </div>

                        <label class="col-md-2 control-label ">徽标</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="logo" id="logo" value="${profile?.logo}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label ">标题</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="title" id="title" value="${profile?.title}"/>
                        </div>

                        <label class="col-md-2 control-label ">地址</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="url" id="url" value="${profile?.url}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-3 col-md-offset-6">
                            <g:submitButton class="btn btn-info" name="update" value="保存"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

</g:form>

<script>
    $(function () {
        $(".editForm").validate({
            ignore: "",
            rules:{
                name:{
                    required:true,
                },
                logo:{
                    required:true,
                },
                title:{
                    required:true,
                },
                url:{
                    required:true,
                }
            },
            messages:{
                name:{
                    required:"请输入名称",
                },
                logo:{
                    required:"请输入徽标",
                },
                title:{
                    required:"请输入标题",
                },
                url:{
                    required:"请输入地址",
                }
            }
        })
    })

</script>
<asset:javascript src="homer/vendor/jquery-validation/jquery.validate.min.js"/>
</body>
</html>
